﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;


    /// <summary>
    /// MapServices 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消注释以下行。 
    // [System.Web.Script.Services.ScriptService]
    public class MapServices : System.Web.Services.WebService
    {
        public static string datefomat = "yyyy/MM/dd HH:mm:ss";

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
        [WebMethod]
        public void getSiteAll(string userkey)
        {
            Context.Response.ContentType = "text/html";
            Context.Response.Charset = "UTF-8"; //设置字符集类型1
            Context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
            msgmodel msgmodel = new msgmodel();
            if (userkey == "68c62a05d5da7e0001e6e402e59c65df")
            {
                string sql = "";
                DataTable dt;
                sql = "select * from fx_site ORDER BY SITE_CODE";
                dt = DbHelperSQL.ExecuteDataSet(sql);

                List<sitemodel> sitelist = new List<sitemodel>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sitemodel sitemodel = new sitemodel();
                    sitemodel.sitecode= dt.Rows[i]["SITE_CODE"].ToString();
                    sitemodel.sitename = dt.Rows[i]["SITE_NAME"].ToString();
                    sitemodel.coordinates = dt.Rows[i]["LONGITUDE"].ToString()+","+ dt.Rows[i]["LATITUDE"].ToString();
                    sitemodel.datetime = dt.Rows[i]["MODIFIED_TIME"].ToString();
                    sitelist.Add(sitemodel);
                }
                msgmodel.sitelist = sitelist;
                msgmodel.state = "success";
            }
            else
            {
                msgmodel.state = "userkey错误！";
            }
        }
        [WebMethod]
        public void getStieOne()
        {
        }
        [WebMethod]
        public void getStieOneHisData()
        {
        }
    }

